package com.sky.mapper.user;//package com.sky.mapper.user;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.HashMap;

@Repository("userUserMapper")
@Mapper
public interface UserMapper {

    @Select("select *from user where openid = #{openId}")
    User selectByOpenId(String openId);

    @Insert("insert into user values(null, #{openId}, #{name}, #{phone}, #{sex}, #{idNumber}, #{avatar}, #{createTime})")
    void register(User user);

    @Select("select *from user where id = #{currentId}")
    User selectById(Long currentId);

    @Select("select count(*) from user where create_time between #{beginTime} and #{endTime}")
    Integer newUsers(HashMap map);
}


//import com.sky.entity.User;
//import org.apache.ibatis.annotations.Mapper;
//import org.apache.ibatis.annotations.Select;
//
//@Mapper
//public interface UserMapper {
//
//    /**
//     * 根据openid查询用户
//     * @param openid
//     * @return
//     */
//    @Select("select * from user where openid = #{openid}")
//    User getByOpenid(String openid);
//
//    /**
//     * 插入数据
//     * @param user
//     */
//    void insert(User user);
//}